package com.study.javaBasic.collections;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

public class SetDemo {
    public static void main(String[] args) {
        /*HashSet持有一个HashMap,具有相同的Value*/
        Set<String> set = new HashSet<>();
        set.add("apple");
        set.add("banana");
        set.add("pear");
        set.add("orange");
        for (String s : set) {
            System.out.println(s);
        }

        Set<String> treeset = new TreeSet<>();
        treeset.add("apple");
        treeset.add("banana");
        treeset.add("pear");
        treeset.add("orange");
        for (String s : treeset) {
            System.out.println(s);
        }
    }
}
